package com.theshy.test.service;

import com.theshy.test.dao.Teacher;
import com.theshy.test.domain.TeacherDao;

public class TeacherService {

    TeacherDao teacherDao = new TeacherDao();

    public boolean isExist(int id) {

        return  teacherDao.isExist(id);
    }

    public boolean AddTeacher(Teacher t) {

        return teacherDao.AddTeacher(t);
    }

    public Teacher[] checkteacher() {
        Teacher[] teachers =  teacherDao.checkTeacher();

        for (int i = 0; i < teachers.length; i++) {
            if(teachers[i]!=null){

                return teachers;
            }
        }
        return null;
    }

    public void Delete(int id) {

        teacherDao.DeleteTeacher(id);

    }

    public void Change(Teacher teacher) {

         teacherDao.changeTeacher(teacher);
    }
}
